<?php
declare(strict_types=1);

namespace app\api\controller\home;

use app\api\controller\Controller;
use think\App;
use think\response\Json;
use app\api\service\home\Game as GameService;

class Game extends Controller
{
    private $gameService;
    public function __construct(App $app,GameService $gameService)
    {
        parent::__construct($app);
        $this->gameService = $gameService;
    }

    /**列表
     * @return Json
     */
    public function index(): Json
    {
        $params = $this->request->get();
        $this->validate(
            $params,
            [
                'page' => 'integer',
                'limit' => 'integer',
                'category_id' => 'integer',
            ]
        );
        $list = $this->gameService->getList($params);
        return $this->renderSuccess($list);
    }

    //分类
    public function categoryList():Json
    {
        $list = $this->gameService->getCategoryList();
        return $this->renderSuccess($list);
    }








}